function[TF] = read_egbert_tf(cfile);


% cfile= '/Users/manojnair/projects/tsunami/x1y1z1z1z2.zss'

% 1=ipm and 2= ppt
% 

      
MeasurementCoordinates = 1;
[Z,Sig_s,Sig_e,periods,ndf,stdec,orient,Nch,Nche,nbt,chid,csta] = Z_in(cfile);
%eval(mkpltind);
NBT = [nbt];
% get info about dipole setup, channel ordering
[xy,yx,hz,xypairs,DipoleSetup] = ecomp(Nche,chid);
% set rotation angle
if ~isempty(xy),
th_x = orient(1,xy(1)+2);
else
th_x = orient(1,2);
end
theta = th_x;
[ dum,Nch] = size(orient);
Nche = Nch - 2;
[Z2x2,SIG_S,SIG_E] = z_to_imp(Z,Sig_e,Sig_s,Nche,xypairs,orient);
[Z2x2R,SIG_SR,SIG_ER]=rot_z(Z2x2,SIG_S,SIG_E,theta);

[Z] = readZfile(cfile);

TF = struct('TF',Z2x2R,'SIG_E',SIG_ER,'SIG_S',SIG_SR,...
	'T',periods,'ndf',ndf,'stcor',stdec(1:2),...
        'theta0',stdec(3),'orient',orient,...
        'chead',Z.chead,'stname',Z.stname,...
        'ibandlim',Z.ibandlim,'level',Z.level,'sampRate',Z.sampRate,...
	    'Nch',Z.Nch,'Nche',Z.Nche,'nbt',nbt,'chid',Z.chid,'sta',Z.sta);



